/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hxg.portmgr.core.device.server;

/**
 *
 * @author hxg
 */
public class SwProcess {

    String hrSwIdx;
    String hrSWRunName;
    String hrSWRunPath = "";
    String hrSWRunParameters = "";
    int hrSWRunType = 1;
    int hrSWRunStatus = 0;
    int hrSWRunPerfCPU = -1;
    int hrSWRunPerfMem = -1;

    public String getHrSwIdx() {
        return hrSwIdx;
    }

    public void setHrSwIdx(String hrSwIdx) {
        this.hrSwIdx = hrSwIdx;
    }

    public void setHrSWRunName(String hrSWRunName) {
        this.hrSWRunName = hrSWRunName;
    }



    public String getHrSWRunName() {
        return hrSWRunName;
    }

    public String getHrSWRunPath() {
        return hrSWRunPath;
    }

    public void setHrSWRunPath(String hrSWRunPath) {
        this.hrSWRunPath = hrSWRunPath;
    }

    public String getHrSWRunParameters() {
        return hrSWRunParameters;
    }

    public void setHrSWRunParameters(String hrSWRunParameters) {
        this.hrSWRunParameters = hrSWRunParameters;
    }

    public int getHrSWRunType() {
        return hrSWRunType;
    }

    public void setHrSWRunType(int hrSWRunType) {
        this.hrSWRunType = hrSWRunType;
    }

    public int getHrSWRunStatus() {
        return hrSWRunStatus;
    }

    public void setHrSWRunStatus(int hrSWRunStatus) {
        this.hrSWRunStatus = hrSWRunStatus;
    }

    public int getHrSWRunPerfCPU() {
        return hrSWRunPerfCPU;
    }

    public void setHrSWRunPerfCPU(int hrSWRunPerfCPU) {
        this.hrSWRunPerfCPU = hrSWRunPerfCPU;
    }

    public int getHrSWRunPerfMem() {
        return hrSWRunPerfMem;
    }

    public void setHrSWRunPerfMem(int hrSWRunPerfMem) {
        this.hrSWRunPerfMem = hrSWRunPerfMem;
    }

    public enum RunType {

        unknown(1),
        operatingSystem(2),
        deviceDriver(3),
        application(4);
        int intValue;

        private RunType(int intValue) {
            this.intValue = intValue;
        }
    }

    public enum Status {

        unknown(0),
        running(1),
        runnable(2),
        notRunnable(3),
        invalid(4);
        int intValue;

        private Status(int intValue) {
            this.intValue = intValue;
        }
    }

    public RunType getRunType() {
        switch (hrSWRunType) {
            case 1:
                return RunType.unknown;
            case 2:
                return RunType.operatingSystem;
            case 3:
                return RunType.deviceDriver;
            case 4:
                return RunType.application;
            default:
                return RunType.unknown;
        }
    }

    public Status getStatus() {
        switch (hrSWRunStatus) {
            case 1:
                return Status.running;
            case 2:
                return Status.runnable;
            case 3:
                return Status.notRunnable;
            case 4:
                return Status.invalid;
            default:
                return Status.unknown;
        }
    }

    @Override
    public String toString() {
        return "SwProcess{" + "hrSwIdx=" + hrSwIdx + ", hrSWRunName=" + hrSWRunName + ", hrSWRunPath=" + hrSWRunPath + ", hrSWRunParameters=" + hrSWRunParameters + ", hrSWRunType=" + hrSWRunType + ", hrSWRunStatus=" + hrSWRunStatus + ", hrSWRunPerfCPU=" + hrSWRunPerfCPU + ", hrSWRunPerfMem=" + hrSWRunPerfMem + '}';
    }
    
}
